@echo off

REM 重启流程： 
REM 1. 关闭 WVP
REM 2. 关闭 MediaServer 
REM 3. 启动 MediaServer 
REM 4. 启动 WVP

echo Try to kill the current process of WVP
for /f "tokens=5" %%i in ('netstat -ano ^| findstr "0.0.0.0:%wvp的HTTP端口%"') do if %%i gtr 0 taskkill /f /pid %%i

echo Try to kill the current process of MediaServer
tasklist | find /i "MediaServer.exe"
if %errorlevel% == 0 (
	taskkill /f /im "MediaServer.exe"
) 

echo Wait to start MediaServer
timeout /t 3
cd %ZLMediaKit安装目录%
start "MediaServer" MediaServer.exe

echo Wait to start WVP
timeout /t 10
cd %wvp安装目录%
title WVP
chcp 65001
java -jar wvp.jar





